process.env.NODE_ENV = 'production';
const webpack = require('webpack');
const configuration = require('../webpack.config');

const compiler = webpack(configuration);

compiler.run((err, stats) => {
  if (err) {
    console.log('Failed to compile.', [err]);
    process.exit(1);
  }

  if (stats.hasErrors()) {
    console.log(stats.toString('errors-only'));
    process.exit(1);
  }

  console.log('build success');
});
